package common.guide
{
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	import flash.display.InteractiveObject;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	import flash.utils.Dictionary;
	
	import kernel.application.ApplicationDisplay;
	
	public class GuideController
	{
		private static var _instance:GuideController;
		
		private var _map:Dictionary;
		
		public function GuideController()
		{
			_map = new Dictionary(true);
		}
		public static function get instance():GuideController
		{
			if(_instance == null)
			{
				_instance = new GuideController();
			}
			return _instance;
		}
		/**
		 * 显示
		 * @param name
		 * 
		 */		
		public function show(owner:DisplayObjectContainer,name:String,mc:DisplayObject,offsetX:int=0, offsetY:int=0):void
		{
			var dis:DisplayObject = _map[name];
			if(dis == null)
			{
				_map[name] = mc;
				dis = mc;
			}
			dis.x += offsetX;
			dis.y += offsetY;
			if(dis.parent==null)
			{
				owner.addChild(dis);
			}
		}
		/**
		 *关闭 
		 * 
		 */		
		public function close(name:String):void
		{
			var dis:DisplayObject = _map[name];
			if(dis != null)
			{
				if(dis.parent!=null)
				{
					dis.parent.removeChild(dis);
				}
				delete  _map[name];
			}
		}
	}
}